package com.itheima.zuoye2.zy2;

import java.security.PublicKey;
import java.util.HashMap;
import java.util.Map;

public class Test {
    public static void main(String[] args) {
        HashMap<String, String> hashMap = new HashMap<>();
        hashMap.put("101", "啊三面馆");
        hashMap.put("102", "啊四粥馆");
        hashMap.put("103", "啊五米馆");
        hashMap.put("104", "啊六快递");
        //使用三种循环输出
//        1.键找值
        for (String key : hashMap.keySet()) {
            System.out.println(key + "--" + hashMap.get(key));
        }
        System.out.println("===================");
        for (Map.Entry<String, String> entry : hashMap.entrySet()) {
            String key = entry.getKey();
            String value = entry.getValue();
            System.out.println(key + "--" + value);

        }

        System.out.println("===================");
        hashMap.forEach(
                (key, value) -> {
                    System.out.println(key + "--" + value);
                }
        );
    }
}
